import request from '@/utils/request'

// api地址
const api = {
  list: '/v1/aftersales/list',
  goods: '/v1/aftersales/getGoods',
  apply: '/v1/aftersales/apply',
  detail: '/v1/aftersales/get',
  delivery: '/v1/aftersales/delivery'
}

// 售后单列表
export const list = (param, option) => {
  return request.get(api.list, param, option)
}

// 订单商品详情
export const goods = (order_id, product_id, param) => {
  return request.get(api.goods, { order_id, product_id, ...param })
}

// 申请售后
export const apply = (product_id, images, type, content, order_id) => {
  return request.post(api.apply, { product_id, images, type, content, order_id })
}

// 售后单详情
export const detail = (apply_id, param) => {
  return request.get(api.detail, { apply_id, ...param })
}

// 用户发货
export const delivery = (orderRefundId, data) => {
  return request.post(api.delivery, { orderRefundId, form: data })
}
